var topic = new Array ();
var from = 0;
var to = 0;


function requestDataTopic (id_topic) {
	if (document.getElementById("topic_"+id_topic).checked==true) {
		topic.push(id_topic);
	} else {
		topic.splice(topic.indexOf(id_topic),1);
	}	
	ajaxx ();
}

function requestDataFrom () {
	from = document.getElementById("filedFrom").value;
	ajaxx ();
}

function requestDataTo () {
	to = document.getElementById("filedTo").value;
	ajaxx ();
}

function ajaxx () {
		$.post(
				"http://localhost/topicscientific/ajax/ajax-template.php",
		    { sendValueTopic: topic,sendValueFrom:from,sendValueTo:to },  
		    function(data){
		    	if (data!=null)
		    		document.getElementById("loop-results-display").innerHTML ="";
		    		document.getElementById("loop-results-display").innerHTML =data.rs;
		    },
		    //How you want the data formated when it is returned from the server.
		    "json"
	    );		
}
